package me.sdevil507.org.repository;

import me.sdevil507.org.po.OrgKeywordPo;
import me.sdevil507.supports.jpa.BaseJpaDslRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.transaction.annotation.Transactional;

/**
 * 机构关键词
 *
 * @author sdevil507
 * created on 2020-07-13 13:40:22
 */
public interface OrgKeywordRepository extends BaseJpaDslRepository<OrgKeywordPo, Long> {

    /**
     * 判断关键词是否在系统中已经存在
     *
     * @param name 关键词
     * @return true/false
     */
    boolean existsByName(String name);

    /**
     * 根据名称删除关键词
     *
     * @param name 名称
     */
    @Transactional(rollbackFor = Exception.class)
    @Modifying(clearAutomatically = true)
    void deleteByName(String name);
}